package com.kkkkkba.search.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.kkkkkba.search.model.dto.code.CodeQueryRequest;
import com.kkkkkba.search.model.entity.Code;
import com.kkkkkba.search.model.vo.CodeVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 代码服务
 *
 */
public interface CodeService extends IService<Code> {

    /**
     * 校验
     *
     * @param code
     * @param add
     */
    void validCode(Code code, boolean add);

    /**
     * 获取查询条件
     *
     * @param codeQueryRequest
     * @return
     */
    QueryWrapper<Code> getQueryWrapper(CodeQueryRequest codeQueryRequest);

//    /**
//     * 从 ES 查询
//     *
//     * @param codeQueryRequest
//     * @return
//     */
//    Page<Code> searchFromEs(CodeQueryRequest codeQueryRequest);

    /**
     * 获取代码封装
     *
     * @param code
     * @param request
     * @return
     */
    CodeVO getCodeVO(Code code, HttpServletRequest request);

    /**
     * 分页获取代码封装
     *
     * @param codePage
     * @param request
     * @return
     */
    Page<CodeVO> getCodeVOPage(Page<Code> codePage, HttpServletRequest request);

    /**
     * 查询代码
     * @param codeQueryRequest
     * @param request
     * @return
     */
    Page<CodeVO>  listCodeVOByPage(CodeQueryRequest codeQueryRequest, HttpServletRequest request);
}
